package com.oywy.rbac.entity;

import lombok.Data;

import javax.persistence.*;
import java.util.Collection;

/**
 * 角色
 *
 * @author oywy
 * @date 2018/10/22
 */
@Data
@Entity
public class Role extends BaseEntity {
    private String name;
    @ManyToMany(targetEntity = Authority.class, fetch = FetchType.EAGER)
    @JoinTable(
            name = "role_authority",
            joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "authority_id", referencedColumnName = "id"))
    private Collection<Authority> authorities;
}
